<!doctype html>
<html lang="en">
<head>
    <meta charset="zh">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Demo</title>
    <link rel="stylesheet" type="text/css" href="{{asset('bst/css/bootstrap.css')}}">

</head>
<body>
    <div class="container">
        <p>@{{ message }}</p>
        <button type="button" class="btn btn-primary" @click="changName" >点我</button>

        <ul class="list-group">
            <template v-for="(item,index) in mylist">
                <li v-if="index==1" class="list-group-item active" >@{{item}}</li>
                <li v-else class="list-group-item" >@{{item}}</li>
            </template>

        </ul>
    </div>
</body>
</html>


<script src="{{asset('common/js/vue.js')}}"></script>
<script src="{{asset('common/js/jquery-3.4.1.min.js')}}"></script>
<script src="{{ asset('js/app.js') }}" defer></script>


<script type="text/javascript">
    var app = new Vue({
        el: '.container',
        data: {
            message: 'dewff',
            mylist:[]
        },
        methods:{
            changName(){
                tem = []
                this.message = 'hi vue!'
                $.get("{{url('/getDemo')}}",function (res) {
                    res.data.records.forEach(el=>{
                        app.mylist.push(el.name)
                    })
                },'json')
            }
        }
    })
</script>



